#! /bin/sh

cd /lxr/custom.d
head -n -3 lxr.conf > lxr_part1.conf
cp lxr_tree_template.conf lxr_newtree.conf
sed -i.bak s/openharmony/$1/g lxr_newtree.conf
cat lxr_part1.conf  lxr_newtree.conf lxr_tail_3line.conf > temp.conf
rm lxr_part1.conf
cp temp.conf lxr.conf
cp lxr.conf ../lxr.conf
rm temp.conf
rm lxr_newtree.conf.bak
rm lxr_newtree.conf

echo "#!bin/sh" > initdb.sh
echo ". custom.d/db-scripts.d/m:$1:lxr_.sh" >> init.db.sh

cd db-scripts.d
cp m:template:lxr_.sh m:$1:lxr_.sh
sed -i.bak s/some_source_code_tree/$1/g m:$1:lxr_.sh
rm m:$1:lxr_.sh.bak

cd /lxr
#expect expect_initdb

#./genxref --url=http://www.lengqinjie.xyz:2000/lxr --tree=$1 


